/*
 * @Author: zhangjingyu
 * @Date: 2020-10-13 14:12:54
 * @LastEditors: zhangjingyu
 * @LastEditTime: 2020-12-30 13:45:10
 * @FilePath: \vprisk-weifuwu\src\mock\permission.js
 * @Description: 
 */
import Mock from 'mockjs'
export default {
  getMenu: config => {
    const { username, password } = JSON.parse(config.body)
    console.log(JSON.parse(config.body))
    // 先 判断用户是否存在
    if (username) {
      // 判断账号和密码是否对应
      if (username === 'admin' && password === 'admin') {
        return {
          code: 20000,
          data: {
            menu: [
              // {
              //   path: '/',
              //   name: 'home',
              //   label: '欢迎界面',
              //   icon: 'iconfont icon-gongchengqiehuan',
              //   url: 'Home/Home'
              // },
              {
                path: '/userManage',
                name: 'userManage',
                label: '用户管理',
                icon: 'iconfont icon-yonghuguanli',
                url: 'SystemMange/userManage'
              },
              {
                path: '/roleManage',
                name: 'roleManage',
                label: '角色管理',
                icon: 'iconfont icon-jiaoseguanli',
                url: 'SystemMange/roleManage'
              },
              {
                path: '/personInfo',
                name: 'personInfo',
                label: '个人信息',
                icon: 'iconfont icon-gerenxinxi',
                url: 'SystemMange/personInfo'
              },
              
              {
                path: '/projectManage',
                name: 'projectManage',
                label: '工程管理',
                icon: 'iconfont icon-gongchengguanli',
                url: 'SystemMange/projectManage'
              },
            
              {
                path: '/orgManage',
                name: 'orgManage',
                label: '机构管理',
                icon: 'iconfont icon-jigouguanli',
                url: 'SystemMange/orgManage'
              },
              {
                path: '/menuManage',
                name: 'menuManage',
                label: '菜单管理',
                icon: 'iconfont icon-caidanguanli',
                url: 'SystemMange/menuManage'
              },
              
              {
                path: '/dictManage',
                name: 'dictManage',
                label: '字典管理',
                icon: 'iconfont icon-zidianguanli',
                url: 'SystemMange/dictManage'
              },
              {
                path: '/onlineUser',
                name: 'onlineUser',
                label: '在线用户监控',
                icon: 'iconfont icon-zaixianyonghujiankong',
                url: 'SystemMange/onlineUser'
              },
              {
                path: '/systemParameterConfig',
                name: 'systemParameterConfig',
                label: '系统参数配置',
                icon: 'iconfont icon-xitongcanshupeizhi',
                url: 'SystemMange/systemParameterConfig'
              },
              {
                path: '/passwordConfig',
                name: 'passwordConfig',
                label: '密码配置',
                icon: 'iconfont icon-mimapeizhi',
                url: 'SystemMange/passwordConfig'
              },
              {
                path: '/operationLog',
                name: 'operationLog',
                label: '操作日志',
                icon: 'iconfont icon-caozuorizhi',
                url: 'SystemMange/operationLog'
              },
              {
                path: '/licenseInfo',
                name: 'licenseInfo',
                label: 'license信息',
                icon: 'iconfont icon-licensexinxi',
                url: 'SystemMange/licenseInfo'
              },
              {
                path: '/buttonPermission',
                name: 'buttonPermission',
                label: '按钮权限管理',
                icon: 'iconfont icon-anniuquanxianguanli',
                url: 'SystemMange/buttonPermission'
              },
              {
                path: '/nodeManage',
                name: 'nodeManage',
                label: '节点管理',
                icon: 'iconfont icon-anniuquanxianguanli',
                url: 'SystemMange/nodeManage'
              }, 
              {
                path: '/tenantManage',
                name: 'tenantManage',
                label: '租户管理',
                icon: 'iconfont icon-anniuquanxianguanli',
                url: 'SystemMange/tenantManage'
              },
            ],
            // 随机生成一个字符串当作token
            token: Mock.Random.guid(),
            message: '获取成功'
          }
        }
      } else if (username === 'gggl' && password === 'admin') {
        return {
          code: 20000,
          data: {
            menu: [
              {
                path: '/currencyManage',
                name: 'currencyManage',
                label: '币种管理',
                icon: 'iconfont icon-jigouguanli',
                url: 'PublicManage/publicManage/currencyManage'
              },
              {
                name: 'curveManagemen',
                label: '曲线管理',
                icon: 'iconfont icon-jigouguanli',
                children: [
                  {
                    path: '/termStructureDefinition',
                    name: 'termStructureDefinition',
                    label: '期限结构定义',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/curveManagemen/termStructureDefinition',
                    
                  },
                  {
                    path: '/baceCurveDefinition',
                    name: 'baceCurveDefinition',
                    label: '基础曲线定义',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/curveManagemen/baceCurveDefinition'
                  },
                  {
                    path: '/curveMaintenance',
                    name: 'curveMaintenance',
                    label: '曲线维护',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/curveManagemen/curveMaintenance'
                  },
                 
                ]
              },
              {
                label: '口径管理',
                icon: 'iconfont icon-gongchengqiehuan',
                children: [
                  {
                    path: '/caliberMembers',
                    name: 'caliberMembers',
                    label: '口径成员',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/caliberManage/caliberMembers',
                  
                  },
                  {
                    path: '/caliberHierarchy',
                    name: 'caliberHierarchy',
                    label: '口径层级',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/caliberManage/caliberHierarchy'
                  },
                  
                ]
              },
              {
                label: '维度管理',
                icon: 'iconfont icon-gongchengqiehuan',
                children: [
                  {
                    path: '/dimensionMembers',
                    name: 'dimensionMembers',
                    label: '维度成员',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/dimensionManage/dimensionMembers',
                  },
                  {
                    path: '/dimensionHierarchy',
                    name: 'dimensionHierarchy',
                    label: '维度层级',
                    icon: 'iconfont icon-gongchengqiehuan',
                    url: 'PublicManage/publicManage/dimensionManage/dimensionHierarchy'
                  },
                ]
              },
            ],
            token: Mock.Random.guid(),
            message: '获取成功'
          }
        }
      } else if (username === 'workflow' && password === 'admin') {
        return {
          code: 20000,
          data: {
            menu: [
              {
                path: '/workflow',
                name: 'workflow',
                label: '工作流',
                icon: 'iconfont icon-jigouguanli',
                url: 'workFlow/bpmn'
              }
            ],
            token: Mock.Random.guid(),
            message: '获取成功'
          }
        }
      }
      
      else {
        return {
          code: -999,
          data: {
            message: '密码错误'
          }
        }
      }
    } else {
      return {
        code: -999,
        data: {
          message: '用户不存在'
        }
      }
    }
  }
}
